package com.vn.ld.btc.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.vn.ld.btc.dao.IIdCounterDao;
import com.vn.ld.btc.dao.entity.IdCounter;

@Repository
public class IdCounterDao extends BaseDao<IdCounter> implements IIdCounterDao<IdCounter> {
	private static final String COUNTER_KEY = "counter_key";
	
	@Override
	public IdCounter getByCounterKey(String key) {
		List<IdCounter> list = this.findByProperty(COUNTER_KEY, key);
		if (list == null || list.isEmpty()) {
			return null;
		}
		
		return list.get(0);
	}
	
}
